
#import "AppDelegate.h"
#import <IQKeyboardManager/IQKeyboardManager.h>
#import <SVProgressHUD/SVProgressHUD.h>
#import <SDWebImageSVGCoder/SDImageSVGCoder.h>
#import <SDWebImage/SDImageCodersManager.h>
#import "SMTheme.h"
#import "SMAuthManager.h"
#import "SMRootTabBarController.h"
#import "SMLoginViewController.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [IQKeyboardManager sharedManager].enable = YES;
    [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    SDImageSVGCoder *SVGCoder = [SDImageSVGCoder sharedCoder];
    [[SDImageCodersManager sharedManager] addCoder:SVGCoder];
    [SMTheme applyGlobalAppearance];

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    UIViewController *rootVC;
    if ([[SMAuthManager shared] isLoggedIn]) {
        rootVC = [[SMRootTabBarController alloc] init];
    } else {
        rootVC = [[UINavigationController alloc] initWithRootViewController:[[SMLoginViewController alloc] init]];
    }
    self.window.rootViewController = rootVC;
    [self.window makeKeyAndVisible];
    return YES;
}

@end
